package com.hui.controller;

import com.hui.pojo.bo.ShopcartBO;
import com.hui.utils.MyJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "购物车接口",tags = {"购物车相关接口API"})
@Slf4j
@RequestMapping("shopcart")
@RestController
public class ShopCatController {

    @ApiOperation(value = "同步购物车",notes = "同步购物车",httpMethod = "POST")
    @PostMapping("/add")
    public MyJSONResult add(@RequestParam String userId,
                            @RequestBody ShopcartBO shopcartBO,
                            HttpServletRequest request,
                            HttpServletResponse response){
        if (StringUtils.isBlank(userId)){
            return MyJSONResult.errorMsg("参数报错");
        }
        log.info("shopcartBO:{}",shopcartBO);
        return MyJSONResult.ok();
    }
}
